package com.hushao.aimi.entity;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.annotations.CreationTimestamp;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.UpdateTimestamp;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import java.io.Serializable;
import java.sql.Timestamp;

/**
 * @description: 购物车信息
 * @author: 胡少
 * @create: 2018-06-03 16:51
 **/
@ApiModel("购物车信息")
@Data
@Entity
public class AimiCart implements Serializable {
    @Id
    @GenericGenerator(name = "uuid",strategy = "uuid")
    @GeneratedValue(generator = "uuid")
    @Column(length = 32)
    private String id;

    /**
     * 用户id
     */
    @Column(length = 32,nullable = false)
    private String userId;

    /**
     * 商品规格id
     */
    @Column(length = 32,nullable = false)
    private String productSpecId;

    @ApiModelProperty("数量")
    @Column(nullable = false)
    private int number;

    @CreationTimestamp
    private Timestamp createTime;

    @UpdateTimestamp
    private Timestamp updateTime;

    @Column(length = 512)
    private String comment;

    public AimiCart(String userId, String productSpecId, int number) {
        this.userId = userId;
        this.productSpecId = productSpecId;
        this.number = number;
    }


}
